package com.qianfeng.viewutils;

import android.graphics.drawable.Drawable;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.ResType;
import com.lidroid.xutils.view.annotation.ContentView;
import com.lidroid.xutils.view.annotation.ResInject;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;

@ContentView(R.layout.activity_main)
public class MainActivity extends AppCompatActivity {
    @ViewInject(R.id.textview)
    private TextView textView;
    @ViewInject(R.id.imageView)
    private ImageView imageView;
    @ViewInject(R.id.button)
    private Button button;
    @ResInject(id = R.string.app_name,type = ResType.String)
    private String appName;
    @ResInject(id = R.mipmap.ic_launcher,type = ResType.Drawable)
    private Drawable drawable;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ViewUtils.inject(this);
        appName = "老罗";
        textView.setText("刘磊");
        button.setText("王茜珂");
        imageView.setImageResource(R.mipmap.ic_launcher);
    }
    @OnClick({R.id.button,R.id.imageView})
    public void onClick(View view){
        switch (view.getId()){
            case R.id.button:
                Toast.makeText(this, "鎸夐挳琚偣鍑", Toast.LENGTH_SHORT).show();
                break;
            case R.id.imageView:
                Toast.makeText(this, "鍥剧墖鍛楃偣鍑", Toast.LENGTH_SHORT).show();
                break;


        }
    }



}
